const path = require('path')

// 写好配置路径
const resolve = (...paths) => {
  return path.resolve(__dirname, ...paths)
}

module.exports = {
  entry: {
    index: {
      import: resolve('index.js')
    }
  },
  module: {
    rules: [{
      test: /\.js$/,
      use: [{
        // npm i @babel/core
        loader: 'babel-loader',
        options: {
          presets: [
            // 依赖于 core-js、regenerator runtime 
            [
              '@babel/preset-env',
              {
                useBuiltIns: "entry",
                corejs: 3,
                targets: '> 0.25%, not dead'
              }
            ]
          ]
        }
      }],
    }]
  },
  // 开发模式打包
  mode: 'development'
}
